﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
using System.Net;

namespace service_desk_blred.Utils
{
    public class EmailUtil
    {

        public static Boolean enviarEmail(String emailTo,String emailFrom, String assunto, String corpo)
        {

            MailAddress to = new MailAddress(emailTo);
            MailAddress from = new MailAddress(emailFrom);
            MailMessage mail = new MailMessage(from, to);

            mail.Subject = assunto;
            mail.Body = corpo;

            SmtpClient smtp = new SmtpClient();
            smtp.Host = "smtp.gmail.com";
            smtp.Port = 587;

            smtp.Credentials = new NetworkCredential(
                "email@gmail.com", "senha");
            smtp.EnableSsl = true;

            try
            {
                smtp.Send(mail);
            }
            catch {
                return false;
            }

            return true;
        }




    }
}